Private Declare Function EnumChildren Lib "user32" Alias "EnumChildWindows" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Private Declare Function GetWin Lib "user32.dll" Alias "GetWindow" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Enum GetWindow
GW_HWNDFIRST = 0
'The highest window in the Z-order having the same parent as the given window.
GW_HWNDLAST = 1
'The lowest window in the Z-order having the same parent as the given window.
GW_HWNDNEXT = 2
'The window below the given window in the Z-order.
GW_HWNDPREV = 3
'The window above the given window in the Z-order.
GW_OWNER = 4
'The window that owns the given window (not to be confused with the parent window).
GW_CHILD = 5
'The topmost of the given window's child windows. This has the same effect as using the GetTopWindow function.
End Enum
Private Declare Function GetWinText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Private Declare Function IsThisWindow Lib "user32.dll" Alias "IsWindow" (ByVal hWnd As Long) As Long
Private Declare Function GetParenthWnd Lib "user32.dll" Alias "GetParent" (ByVal hWnd As Long) As Long
Private Declare Function SetParenthWnd Lib "user32.dll" Alias "SetParent" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Declare Function ComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function MoveWindow Lib "user32.dll" Alias "SetWindowPos" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindow Lib "user32.dll" Alias "GetWindowRect" (ByVal hWnd As Long, lpRect As Rect) As Long
'Private Declare Function GetKeyState Lib "user32" _
'(ByVal nVirtKey As Long) As Long
Private Declare Function GetKeyboardState Lib "user32" _
(kbArray As KeyboardBytes) As Long
Private Declare Function SetKeyboardState Lib "user32" _
(kbArray As KeyboardBytes) As Long
'''''''''''''''''''''''''''''''''''''''''''''
''''remove close 'x' button''''''''''''''''''
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
''''''''''''''''''''''''''''''''''''''''''''
Const SWP_FRAMECHANGED = &H20
Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Const SWP_HIDEWINDOW = &H80
Const SWP_NOACTIVATE = &H10
Const SWP_NOCOPYBITS = &H100
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const SWP_NOREDRAW = &H8
Const SWP_NOZORDER = &H4
Const SWP_SHOWWINDOW = &H40
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Enum ZOrder
HWND_BOTTOM = 1
HWND_NOTOPMOST = -2
HWND_TOP = 0
HWND_TOPMOST = -1
End Enum
Enum OnOff
[Turn Off] = -1
[Turn On] = 1
End Enum
Private m_vShow As Boolean
'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Label1.Caption = Extender.Name
m_vShow = True
End Sub
Private Sub UserControl_InitProperties()
Label1 = Extender.Name
m_vShow = True
End Sub
Public Function GetComputerName() As String
Attribute GetComputerName.VB_Description = "Returns the network name of the user's computer."
Dim compname As String * 255, cname As String
Call ComputerName(compname, 255)
cname = Trim(compname)
GetComputerName = Left(cname, Len(cname) - 1)
End Function
Public Sub DisableSystemKeys(ByVal bDisabled As Boolean)
Attribute DisableSystemKeys.VB_Description = "Toggle the enabled property of ctl-alt-del, ctl-esc, atl-tab, and win95 keyboard keys. Its all or nothing as there is no way to specify which system keys to toggle."
Public Function GetParent(ByVal hWnd As Long) As Long
Attribute GetParent.VB_Description = "Returns the handle of the parent window of another window. For example, the parent of a button would normally be the form window it is in."
GetParent = GetParenthWnd(hWnd)
End Function
Public Sub SetParent(ByVal Child_hWnd As Long, ByVal NewParent_hWnd As Long)
Attribute SetParent.VB_Description = "Moves a window from having one parent window to another. If needed, the window itself moves so it can be ""inside"" its new parent."
Call SetParenthWnd(Child_hWnd, NewParent_hWnd)
End Sub
Public Sub SetWindowPos(ByVal hWnd As Long, Order As ZOrder, _
ByVal Left As Single, ByVal Top As Single)
Attribute SetWindowPos.VB_Description = "Moves a window to a new location. Its physical coordinates, dimensions, and Z-order position (the Z-order determines which windows are on top of others) can be set."
Dim flags As Long
Left = Left / Screen.TwipsPerPixelX
Top = Top / Screen.TwipsPerPixelY
flags = SWP_NOSIZE Or SWP_DRAWFRAME ' don't resize, but redraw window